﻿using System;
using System.Windows;
using Profit.Views.Interfaces;

namespace Profit.Views
{
    /// <summary>
    /// Interaction logic for AgentView.xaml
    /// </summary>
    public partial class AgentView : Window, IAgentView
    {
        public AgentView()
        {
            InitializeComponent();
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
        }

        public AgentView(IView parent) 
            : this()
        {
            if(parent ==null)throw new ArgumentNullException("parent");
            this.Owner = (Window)parent;
        }
        /// <summary>
        /// Show a dialog view
        /// </summary>
        /// <param name="parent"></param>
        /// <returns></returns>
        public bool? ShowDialog(IView parent)
        {
            this.Owner = (Window)parent;
            this.WindowStartupLocation = this.Owner == null
                                             ? WindowStartupLocation.CenterScreen
                                             : WindowStartupLocation.CenterOwner;

            return ShowDialog();
        }
    }
}
